package com.arkisv.log.controller;/**
 * Created by fb on 2017/2/7.
 */

import com.arkisv.common.model.EventLog;
import com.arkisv.common.model.ParamLog;
import com.arkisv.common.model.Res;
import com.arkisv.common.model.StepLog;
import com.arkisv.log.service.IEventLogService;
import com.arkisv.log.service.IParamLogService;
import com.arkisv.log.service.IStepLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 日志控制器
 * Created by fb on 2017/2/7.
 */
@Controller
@RequestMapping("/log")
public class LogController {
    @Autowired
    private IEventLogService eventLogService;
    @Autowired
    private IStepLogService stepLogService;
    @Autowired
    private IParamLogService paramLogService;

    /**
     * 获取事件日志列表
     * @param request
     * @param eventLog
     * @return
     */
    @RequestMapping("/event/list")
    @ResponseBody
    public Res getEventList(HttpServletRequest request, EventLog eventLog){
        System.out.println("event list");
        List<EventLog> logList = eventLogService.list(eventLog);
        return Res.success(logList);
    }

    /**
     * 获取步骤日志列表
     * @param request
     * @param stepLog
     * @return
     */
    @RequestMapping("/step/list")
    @ResponseBody
    public Res getStepList(HttpServletRequest request, StepLog stepLog){
        List<StepLog> logList = stepLogService.list(stepLog);
        return Res.success(logList);
    }


    /**
     * 获取参数日志列表
     * @param request
     * @param paramLog
     * @return
     */
    @RequestMapping("/param/list")
    @ResponseBody
    public Res getParamList(HttpServletRequest request, ParamLog paramLog){
        List<ParamLog> logList = paramLogService.list(paramLog);
        return Res.success(logList);
    }

}
